{extend name="base" /} {block name="body"}
<div class="right">
	<div class="rigtop">
		<span class="title">商品订单</span>
	</div>
	<div class="indrig_con orders_con">
		<div class="orders_topbox clearfix">
			<form action="{:url('shop/orders')}" method="get">
			<div class="chax_rowbox clearfix">
				<div class="shxx_row clearfix">
					<div class="left">订单编号：</div>
					<div class="right clearfix">
						<input type="text" name="order_sn" value="{$order_sn}" placeholder="请输入订单编号" class="chax_input" />
					</div>
					<div class="left" style="margin-left: 10px;">订单状态：</div>
					<div class="right clearfix">
						<div id="htselect">
							<select name="status">
								<option value="">全部</option>
								<option value="1" {if $status == 1}selected="selected"{/if} >待付款</option>
								<option value="2" {if $status == 2}selected="selected"{/if}>待发货</option>
								<option value="3" {if $status == 3}selected="selected"{/if}>待确认</option>
								<option value="4" {if $status == 4}selected="selected"{/if}>待评价</option>
								<option value="8" {if $status == 8}selected="selected"{/if}>已取消</option>
							</select>
						</div>
					</div>
					
				</div>
			</div>
			<div class="chax_rowbox clearfix">
				<div class="shxx_row chax_row clearfix">
					<div class="left">下单时间：</div>
					<div class="right clearfix">
						<input type="text" name="begin_time" value="{$begin_time}" placeholder="开始时间" id="begin_time" class="chax_input" />
						<i class="chax_line"></i>
						<input type="text" name="end_time" value="{$end_time}" placeholder="结束时间" id="end_time" class="chax_input" />
					</div>
				</div>
				<button type="submit" class="htcxbtn">查询</button>
			</div>
			</form>
		</div>
		<div class="orders_content" style="margin-top: 0px;">
				{volist name="list" id="vo" empty="$empty"}
				<table class="zizh_table1" style="margin-top: 8px;">
				<thead>
					<tr class="special">
						<th colspan="8">
							<span>订单号：{$vo.order_sn}</span>
							<span>订单类型：
								{switch name="$vo.order_type"}
							 	{case value="1"}快递订单{/case}
							 	{case value="2"}O2O订单{/case}
							    {default /}都可以
							{/switch}
								
							</span>
						</th>
					</tr>
					<tr class="special">
						<th colspan="8" style="background: white; font-weight: normal;">备注：{$vo.memo},地址:{$vo.address}</th>
					</tr>
					<tr>
						<th>商品名称</th>
						<th>用户手机号</th>
						<th>实付金额</th>
						<th>下单时间</th>
						<th>收货人</th>
						<th>支付时间</th>
						<th>订单状态</th>
					</tr>
				</thead>
				<tbody id="tbody">
					<tr>
						<td>{$vo.goods_name}</td>
						<td>{$vo.mobile}</td>
						<td>{$vo.pay_price}</td>
						<td>{$vo.add_time}</td>
						<td>{$vo.consignee}</td>
						<td>{$vo.pay_time}</td>
						<td>
							{switch name="$vo.status"}
							 	{case value="1"}待付款{/case}
							 	{case value="2"}<a href="#" onclick="order('{:url('shop/order_add',['order_sn'=>$vo.order_sn])}')">待发货</a>{/case}
							 	{case value="3"}待确认{/case}
							 	{case value="4"}待评价{/case}
							 	{case value="8"}已取消{/case}
							    {default /}退货
							{/switch}
						</td>
						
					</tr>
				</tbody>
				</table>
				{/volist}
			
			<div class="fenye" style="display: block;">
				<ul class="pagination">
					{$list->render()}
				</ul>
			</div>
		</div>
	</div>
</div>

{/block}
{block name="script"}
<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css">
<script>
	function order(url) {
		layer.open({
			type: 2,
			title: '发货',
			shadeClose: true,
			shade: 0.8,
			area: ['500px', '370px'],
			content: url
		});
	}
	layui.use('laydate', function() {
		var laydate = layui.laydate;

		//日期控件
		laydate.render({
			elem: '#begin_time',
			type: 'datetime',
			format: 'yyyy-MM-dd HH:mm:ss'
		});

		laydate.render({
			elem: '#end_time',
			type: 'datetime',
			format: 'yyyy-MM-dd HH:mm:ss'
		});
	})
	//时间区间
	function check_time() {
		var begin_time = $('#begin_time').val();
		var end_time = $('#end_time').val();
		if(begin_time.length > 2 || end_time.length > 2) {
			if(begin_time.length < 2 || end_time.length < 2) {
				layer.msg("请输入查询时间区间");
				return false;
			}

		}
	}
</script>
{/block}